package syscore_service

import (
	"github.com/EDDYCJY/go-gin-example/models"
	"github.com/jinzhu/now"
)

type ImageRequest struct {
	Prompt    string `json:"prompt"`
	Style     string `json:"style"`
	Width     int    `json:"width"`
	Height    int    `json:"height"`
	Model     string `json:"model"`
	NumImages int    `json:"num_images"`
}

type Home struct {
}

func (t *Home) Home() (interface{}, error) {

	// SDK 版本要求≥ 1.1.23，建议使用最新版 SDK，参考文档https://www.volcengine.com/docs/82379/1541595

	// client := arkruntime.NewClientWithApiKey(os.Getenv("ARK_API_KEY"))
	// ctx := context.Background()

	// generateReq := model.GenerateImagesRequest{
	// 	Model:          "doubao-seededit-3-0-i2i-250628",
	// 	Prompt:         "这个是名优家纺的图片需要设计一个广告位的图片",
	// 	Image:          volcengine.String("https://osss.fangzhifu.com/images/840/2025082810533540782.jpeg"),
	// 	ResponseFormat: volcengine.String(model.GenerateImagesResponseFormatURL),
	// 	Seed:           volcengine.Int64(123),
	// 	GuidanceScale:  volcengine.Float64(5.5),
	// 	Size:           volcengine.String(model.GenerateImagesSizeAdaptive),
	// 	Watermark:      volcengine.Bool(true),
	// }

	// imagesResponse, err := client.GenerateImages(ctx, generateReq)
	// if err != nil {
	// 	fmt.Printf("generate images error: %v\n", err)
	// 	return nil, nil
	// }

	// fmt.Printf("%s\n", *imagesResponse.Data[0].Url)
	var start_time = now.BeginningOfDay().Format("2006-01-02 15:04:05")
	var end_time = now.EndOfDay().Format("2006-01-02 15:04:05")
	//今日总数
	maps := map[string]interface{}{
		"create_time between": []string{start_time, end_time},
	}
	day_goods_count, _ := models.GetGoodsTotal(maps)
	day_streamer_count, _ := models.GetInstitutionTotal(maps)

	//总数
	maps = map[string]interface{}{}
	goods_count, _ := models.GetGoodsTotal(maps)
	streamer_count, _ := models.GetInstitutionTotal(maps)

	return map[string]interface{}{
		"day_goods_count":    day_goods_count,
		"day_streamer_count": day_streamer_count,
		"goods_count":        goods_count,
		"streamer_count":     streamer_count,
	}, nil

}
